//
//  ViewController.m
//  iOS 设置tabBarItem图标大小
//
//  Created by 李煜 on 2023/8/3.
//https://blog.51cto.com/u_16175430/6722384?u_atoken=3298bcbd-2b0b-49e1-aecb-98cfd80812cf&u_asession=018RJF_mWyGfg3IZe5XdEw5ItJxpD3yu7UewALoqHmEsIWhRxVyGYsVUb9S_Ip0l43X0KNBwm7Lovlpxjd_P_q4JsKWYrT3W_NKPr8w6oU7K-S-P9BcZwhnc4mcJvyNsTOO0uwDPR9XlF566xraDvT9mBkFo3NEHBv0PZUm6pbxQU&u_asig=05Y3_7uvSQPfeIm07fP1vQdhhi0ptziR5f11HgioeZH9XuVt5txVJs1-aSINj3E1_JKy7ZS9cbMxNblPZJe-7qnX9lOo0wZizFtLM4KjLIbHnwXMjQ8DWE1XHACTWuJWHHCaKE_pyupbHhLKuEh31pl4bfMPVFDjjZlA01QFMh64v9JS7q8ZD7Xtz2Ly-b0kmuyAKRFSVJkkdwVUnyHAIJzYrDLPYiw1qZ-N8DdrUGSjgcYLTLQi_8-xw6PLJb19S4_6yRmLu26qT8kGfcS-Yaeu3h9VXwMyh6PgyDIVSG1W93HwR6oqHzyD7cc0GPw7RmludezVo7Q-46b6pGQrpFXrHTDuf3VlPT81Cn0PEqCOJUmdTK4aApVXeTMzWuLijSmWspDxyAEEo4kbsryBKb9Q&u_aref=6%2BDp%2FOXf2Sjjw0mUqIYXnIosHX4%3D

#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imgView;

@end

@implementation ViewController
- (void)awakeFromNib{
    [super awakeFromNib];

    //.image
    self.tabBarItem.image = [self drawAnImage:[UIImage systemImageNamed:@"trash"] size:CGSizeMake(40, 40)];
    self.tabBarItem.selectedImage = [self drawAnImage:[UIImage systemImageNamed:@"trash.fill"] size:CGSizeMake(40, 40)];

}
- (void)viewDidLoad {
    [super viewDidLoad];


    self.imgView.image = [self drawAnImage:[UIImage systemImageNamed:@"pencil"] size:CGSizeMake(500, 500)];


}

- (UIImage*)drawAnImage:(UIImage *)originalImage size:(CGSize)desireImageSize{

    //调整图标的大小
    UIGraphicsBeginImageContextWithOptions(desireImageSize, NO, 0.0);

    [originalImage drawInRect:CGRectMake(0, 0, desireImageSize.width, desireImageSize.height)];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;
}
@end
